(library (logging)
  (export debug info warning error)
  (import (except (rnrs base) let-values error)
          (only (guile)
                ;; lambda forms
                lambda* λ
                ;; errors
                error
                ;; conditionals
                when
                ;; output
                display
                ;; ports
                current-output-port
                ;; strings
                string-join
                simple-format)))


(define displayln
  (lambda* (#:key (output-port (current-output-port)) (verbose #t) . msgs)
    (when verbose
      (display (string-append
                (string-join
                 (map (lambda (msg) (simple-format #f "~a" msg)) msgs)
                 " ") "\n")
               output-port))))


;; Currently all logging procedures are merely aliases for displayln.
(define debug displayln)
(define info displayln)
(define warning displayln)
(define error displayln)
